package com.da.javatest.leetCode;

/**
 * @author chenlida
 * @date 2018/12/17 14:08
 * @description
 */
public class Code476 {
    public static void main(String[] args) {
        //System.out.println(1 << 3);
        //System.out.println(5 ^ 7);
        System.out.println(new Code476().findComplement(5));
    }

    public int findComplement(int num) {
        return num ^ ((1 << Integer.toBinaryString(num).length()) - 1);
    }
}
